package pyip.lib.javalearn.thread.exit;

public class MainSubLifeCycleDemo2 {

    public static void main(String[] args) {
        System.out.println(Thread.currentThread().getName() + " is start");
        System.out.println("isDaemon: " + Thread.currentThread().isDaemon());

        new Thread() {
            public void run() {
                System.out.println("\tisDaemon: " + Thread.currentThread().isDaemon());

                new Thread() {
                    public void run() {
                        System.out.println("\t\tisDaemon: " + Thread.currentThread().isDaemon());
                        try {
                            Thread.sleep(2000);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        System.out.println("\t\tsub thread exit");
                    }
                }.start();

                System.out.println("\tparent thread exit");
            }
        }.start();

        System.out.println(Thread.currentThread().getName() + " exit");

    }
}